|
|
|
|
|
|
|
Now you need to add two lines of code to the project. Open the cmdGetList_Click event and enter the following lines of code: |
|
|
|
|
|
|
|
|
Private Sub cmdGetList_Click()
Text1 = DBList1.ListField
Text2 = DBList1.TEXT
End Sub |
|
|
|
|
|
|
|
|
These two lines of code update the text box controls each time you press the GetList button on the form. That way you are able to see the current values of the ListField and Text properties of the data-bound list control. |
|
|
|
|
|
|
|
|
Save the form as LSTCNTRL.FRM and the project as LSTCNTRL.VBP. Now run the project. When the form first comes up, you see the list box already filled with all the values in the NameText column of the data set (that is, the ListField used for the DBList). Select one of the items in the list box by clicking on it. Now press the GetList button. You'll see the two text controls updated with the ListField and Text values of the list control. Your screen should look like the one in Figure 12.3. |
|
|
|
|
|
|
|
|
Figure 12.3.
Running the LSTCNTRL.VBP project. |
|
|
|
|
|
|
|
|
The data-bound list control has two more properties that you need to know. These are the properties that you can use to create an output value based on the item selected from the list. The two properties are |
|
|
|
|
|
|
|
|
· BoundColumn: The name of the column in the RowSource data set that is used to provide the output of the list selection. This can be the same column designated in the ListField property, or it can be any other column in the RowSource data set. |
|
|
|
|
|
|
|
|
· BoundText: The value of the column designated by the BoundColumn property. This is the actual output of the list selection. |
|
|
|
|
|